home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / game / role / ldmud-3.2-bin.lha / mud / doc / efun / transpose_array < prev    next >
Text File  |  2001-07-26  |  745b  |  23 lines

  1. SYNOPSIS
  2.         mixed *transpose_array (mixed *arr);
  3.  
  4. DESCRIPTION
  5.         transpose_array ( ({ ({1,2,3}), ({a,b,c}) }) )
  6.                         == ({ ({1,a}), ({2,b}), ({3,c}) })
  7.  
  8.         transpose_array() applied to an alist results in an array of
  9.         ({ key, data }) pairs, useful if you want to use sort_array()
  10.         or filter() on the alist.
  11.  
  12. EXAMPLE
  13.         sort_array(transpose_array( ({ m_indices(map), m_values(map) }) ),
  14.                    lambda( ({ 'a, 'b }),
  15.                            ({ #'<, ({ #'[, 'a, 0 }),
  16.                                    ({ #'[, 'b, 0}) }) )
  17.  
  18.         The given mapping 'map' is returned as an array of
  19.         ({ key, data }) pairs, sorted by the keys.
  20.  
  21. SEE ALSO
  22.         alists(LPC), sort_array(E)
  23.